/*
 * Copyright [2013-2021], Alibaba Group Holding Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.alibaba.polardbx.optimizer.planmanager;

//import com.github.luben.zstd.Zstd;

import com.google.common.collect.Lists;
import org.junit.Test;

import java.util.List;

/**
 * test shows zlib might be a better perf than zstd(radio and cpu)
 * <p>
 * test zstd need to import zstd lib and bind jni
 * <p>
 * most important,test shows compress cost far more time than decompress.
 * <p>
 * Decompress plans is much fast.
 */

public class PlanCompressTest {
    String[] plans = {
        "{\n" + "  \"rels\": [\n" + "    {\n" + "      \"id\": \"0\",\n" + "      \"relOp\": \"0\",\n"
            + "      \"table\": [\n" + "        \"FANGWU_TPCH_APP\",\n" + "        \"orders2\"\n" + "      ],\n"
            + "      \"tableNames\": [\n" + "        \"orders2\"\n" + "      ],\n" + "      \"pushDownOpt\": {\n"
            + "        \"pushrels\": \"{\\n  \\\"rels\\\": [\\n    {\\n      \\\"id\\\": \\\"0\\\",\\n      \\\"relOp\\\": \\\"1\\\",\\n      \\\"table\\\": [\\n        \\\"FANGWU_TPCH_APP\\\",\\n        \\\"orders2\\\"\\n      ],\\n      \\\"inputs\\\": []\\n    },\\n    {\\n      \\\"id\\\": \\\"1\\\",\\n      \\\"relOp\\\": \\\"5\\\",\\n      \\\"fields\\\": [\\n        \\\"o_orderkey\\\",\\n        \\\"o_clerk\\\"\\n      ],\\n      \\\"exprs\\\": [\\n        {\\n          \\\"input\\\": 0,\\n          \\\"name\\\": \\\"$0\\\"\\n        },\\n        {\\n          \\\"input\\\": 6,\\n          \\\"name\\\": \\\"$6\\\"\\n        }\\n      ]\\n    }\\n  ]\\n}\",\n"
            + "        \"comparatives\": [],\n" + "        \"fullComparatives\": []\n" + "      },\n"
            + "      \"unionSize\": -1,\n" + "      \"parallel\": true\n" + "    },\n" + "    {\n"
            + "      \"id\": \"1\",\n" + "      \"relOp\": \"0\",\n" + "      \"table\": [\n"
            + "        \"FANGWU_TPCH_APP\",\n" + "        \"lineitem\"\n" + "      ],\n" + "      \"tableNames\": [\n"
            + "        \"lineitem\"\n" + "      ],\n" + "      \"pushDownOpt\": {\n"
            + "        \"pushrels\": \"{\\n  \\\"rels\\\": [\\n    {\\n      \\\"id\\\": \\\"0\\\",\\n      \\\"relOp\\\": \\\"1\\\",\\n      \\\"table\\\": [\\n        \\\"FANGWU_TPCH_APP\\\",\\n        \\\"lineitem\\\"\\n      ],\\n      \\\"inputs\\\": []\\n    },\\n    {\\n      \\\"id\\\": \\\"1\\\",\\n      \\\"relOp\\\": \\\"4\\\",\\n      \\\"condition\\\": {\\n        \\\"op\\\": \\\"SqlBinaryOperator>\\\",\\n        \\\"operands\\\": [\\n          {\\n            \\\"input\\\": 5,\\n            \\\"name\\\": \\\"$5\\\"\\n          },\\n          {\\n            \\\"index\\\": 0,\\n            \\\"reltype\\\": {\\n              \\\"type\\\": \\\"BIGINT\\\",\\n              \\\"nullable\\\": false,\\n              \\\"precision\\\": 19\\n            },\\n            \\\"type\\\": \\\"DYNAMIC\\\"\\n          }\\n        ]\\n      }\\n    },\\n    {\\n      \\\"id\\\": \\\"2\\\",\\n      \\\"relOp\\\": \\\"5\\\",\\n      \\\"fields\\\": [\\n        \\\"l_orderkey\\\"\\n      ],\\n      \\\"exprs\\\": [\\n        {\\n          \\\"input\\\": 0,\\n          \\\"name\\\": \\\"$0\\\"\\n        }\\n      ]\\n    }\\n  ]\\n}\",\n"
            + "        \"comparatives\": [\n" + "          {}\n" + "        ],\n" + "        \"fullComparatives\": [\n"
            + "          {}\n" + "        ]\n" + "      },\n" + "      \"unionSize\": -1,\n"
            + "      \"parallel\": true\n"
            + "    },\n" + "    {\n" + "      \"id\": \"2\",\n" + "      \"relOp\": \"19\",\n"
            + "      \"condition\": {\n"
            + "        \"op\": \"SqlBinaryOperator=\",\n" + "        \"operands\": [\n" + "          {\n"
            + "            \"input\": 2,\n" + "            \"name\": \"$2\"\n" + "          },\n" + "          {\n"
            + "            \"input\": 0,\n" + "            \"name\": \"$0\"\n" + "          }\n" + "        ]\n"
            + "      },\n" + "      \"joinType\": \"INNER\",\n" + "      \"equalCondition\": {\n"
            + "        \"op\": \"SqlBinaryOperator=\",\n" + "        \"operands\": [\n" + "          {\n"
            + "            \"input\": 2,\n" + "            \"name\": \"$2\"\n" + "          },\n" + "          {\n"
            + "            \"input\": 0,\n" + "            \"name\": \"$0\"\n" + "          }\n" + "        ]\n"
            + "      },\n" + "      \"parallel\": true,\n" + "      \"parallelBuild\": true,\n"
            + "      \"inputs\": [\n"
            + "        \"0\",\n" + "        \"1\"\n" + "      ]\n" + "    },\n" + "    {\n" + "      \"id\": \"3\",\n"
            + "      \"relOp\": \"5\",\n" + "      \"fields\": [\n" + "        \"l_orderkey\",\n"
            + "        \"o_orderkey\",\n" + "        \"o_clerk\"\n" + "      ],\n" + "      \"exprs\": [\n"
            + "        {\n"
            + "          \"input\": 2,\n" + "          \"name\": \"$2\"\n" + "        },\n" + "        {\n"
            + "          \"input\": 0,\n" + "          \"name\": \"$0\"\n" + "        },\n" + "        {\n"
            + "          \"input\": 1,\n" + "          \"name\": \"$1\"\n" + "        }\n" + "      ]\n" + "    },\n"
            + "    {\n" + "      \"id\": \"4\",\n" + "      \"relOp\": \"12\",\n" + "      \"group\": [],\n"
            + "      \"aggs\": [\n" + "        {\n" + "          \"agg\": \"SqlCountAggFunctionCOUNT\",\n"
            + "          \"type\": {\n" + "            \"type\": \"BIGINT\",\n" + "            \"nullable\": false,\n"
            + "            \"precision\": 19\n" + "          },\n" + "          \"distinct\": false,\n"
            + "          \"operands\": [\n" + "            2\n" + "          ]\n" + "        }\n" + "      ],\n"
            + "      \"parallel\": true,\n" + "      \"partial\": true\n" + "    },\n" + "    {\n"
            + "      \"id\": \"5\",\n" + "      \"relOp\": \"12\",\n" + "      \"group\": [],\n" + "      \"aggs\": [\n"
            + "        {\n" + "          \"agg\": \"SqlSumAggFunctionSUM\",\n" + "          \"type\": {\n"
            + "            \"type\": \"BIGINT\",\n" + "            \"nullable\": false,\n"
            + "            \"precision\": 19\n" + "          },\n" + "          \"distinct\": false,\n"
            + "          \"operands\": [\n" + "            0\n" + "          ]\n" + "        }\n" + "      ],\n"
            + "      \"parallel\": true\n" + "    }\n" + "  ]\n" + "}",
        " {\"rels\":[{\"id\":\"0\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"part\"],\"tableNames\":[\"part\",\"partsupp\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"part\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"partsupp\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"2\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperatorAND\\\",\\\"operands\\\":[{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":5,\\\"name\\\":\\\"$5\\\"},{\\\"index\\\":0,\\\"reltype\\\":{\\\"type\\\":\\\"BIGINT\\\",\\\"nullable\\\":false,\\\"precision\\\":19},\\\"type\\\":\\\"DYNAMIC\\\"}]},{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":9,\\\"name\\\":\\\"$9\\\"},{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"}]},{\\\"op\\\":\\\"SqlLikeOperatorLIKE\\\",\\\"operands\\\":[{\\\"input\\\":4,\\\"name\\\":\\\"$4\\\"},{\\\"index\\\":1,\\\"reltype\\\":{\\\"type\\\":\\\"CHAR\\\",\\\"nullable\\\":false,\\\"precision\\\":1},\\\"type\\\":\\\"DYNAMIC\\\"}]}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"0\\\",\\\"1\\\"]},{\\\"id\\\":\\\"3\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"p_partkey\\\",\\\"p_mfgr\\\",\\\"ps_suppkey\\\",\\\"ps_supplycost\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"},{\\\"input\\\":2,\\\"name\\\":\\\"$2\\\"},{\\\"input\\\":10,\\\"name\\\":\\\"$10\\\"},{\\\"input\\\":12,\\\"name\\\":\\\"$12\\\"}]}]}\",\"comparatives\":[{},{}],\"fullComparatives\":[{},{}]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"1\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"supplier\"],\"tableNames\":[\"supplier\",\"nation\",\"region\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"supplier\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"nation\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"2\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":7,\\\"name\\\":\\\"$7\\\"},{\\\"input\\\":3,\\\"name\\\":\\\"$3\\\"}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"0\\\",\\\"1\\\"]},{\\\"id\\\":\\\"3\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"region\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"4\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperatorAND\\\",\\\"operands\\\":[{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":12,\\\"name\\\":\\\"$12\\\"},{\\\"index\\\":2,\\\"reltype\\\":{\\\"type\\\":\\\"CHAR\\\",\\\"nullable\\\":false,\\\"precision\\\":1},\\\"type\\\":\\\"DYNAMIC\\\"}]},{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":9,\\\"name\\\":\\\"$9\\\"},{\\\"input\\\":11,\\\"name\\\":\\\"$11\\\"}]}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"2\\\",\\\"3\\\"]},{\\\"id\\\":\\\"5\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"s_suppkey\\\",\\\"s_name\\\",\\\"s_address\\\",\\\"s_phone\\\",\\\"s_acctbal\\\",\\\"s_comment\\\",\\\"n_name\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"},{\\\"input\\\":1,\\\"name\\\":\\\"$1\\\"},{\\\"input\\\":2,\\\"name\\\":\\\"$2\\\"},{\\\"input\\\":4,\\\"name\\\":\\\"$4\\\"},{\\\"input\\\":5,\\\"name\\\":\\\"$5\\\"},{\\\"input\\\":6,\\\"name\\\":\\\"$6\\\"},{\\\"input\\\":8,\\\"name\\\":\\\"$8\\\"}]}]}\",\"comparatives\":[{},{},{}],\"fullComparatives\":[{},{},{}]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"2\",\"relOp\":\"19\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":2,\"name\":\"$2\"},{\"input\":4,\"name\":\"$4\"}]},\"joinType\":\"INNER\",\"equalCondition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":2,\"name\":\"$2\"},{\"input\":4,\"name\":\"$4\"}]},\"parallel\":true,\"parallelBuild\":true,\"inputs\":[\"0\",\"1\"]},{\"id\":\"3\",\"relOp\":\"5\",\"fields\":[\"p_partkey\",\"p_mfgr\",\"s_name\",\"s_address\",\"s_phone\",\"s_acctbal\",\"s_comment\",\"ps_supplycost\",\"n_name\"],\"exprs\":[{\"input\":0,\"name\":\"$0\"},{\"input\":1,\"name\":\"$1\"},{\"input\":5,\"name\":\"$5\"},{\"input\":6,\"name\":\"$6\"},{\"input\":7,\"name\":\"$7\"},{\"input\":8,\"name\":\"$8\"},{\"input\":9,\"name\":\"$9\"},{\"input\":3,\"name\":\"$3\"},{\"input\":10,\"name\":\"$10\"}]},{\"id\":\"4\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"partsupp\"],\"tableNames\":[\"partsupp\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"partsupp\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"ps_partkey\\\",\\\"ps_suppkey\\\",\\\"ps_supplycost\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"},{\\\"input\\\":1,\\\"name\\\":\\\"$1\\\"},{\\\"input\\\":3,\\\"name\\\":\\\"$3\\\"}]}]}\",\"comparatives\":[],\"fullComparatives\":[]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"5\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"supplier\"],\"tableNames\":[\"supplier\",\"nation\",\"region\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"supplier\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"nation\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"2\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":3,\\\"name\\\":\\\"$3\\\"},{\\\"input\\\":7,\\\"name\\\":\\\"$7\\\"}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"0\\\",\\\"1\\\"]},{\\\"id\\\":\\\"3\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"region\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"4\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperatorAND\\\",\\\"operands\\\":[{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":12,\\\"name\\\":\\\"$12\\\"},{\\\"index\\\":3,\\\"reltype\\\":{\\\"type\\\":\\\"CHAR\\\",\\\"nullable\\\":false,\\\"precision\\\":1},\\\"type\\\":\\\"DYNAMIC\\\"}]},{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":9,\\\"name\\\":\\\"$9\\\"},{\\\"input\\\":11,\\\"name\\\":\\\"$11\\\"}]}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"2\\\",\\\"3\\\"]},{\\\"id\\\":\\\"5\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"s_suppkey\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"}]}]}\",\"comparatives\":[{},{},{}],\"fullComparatives\":[{},{},{}]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"6\",\"relOp\":\"19\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":1,\"name\":\"$1\"},{\"input\":3,\"name\":\"$3\"}]},\"joinType\":\"INNER\",\"equalCondition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":1,\"name\":\"$1\"},{\"input\":3,\"name\":\"$3\"}]},\"parallel\":true,\"parallelBuild\":true,\"inputs\":[\"4\",\"5\"]},{\"id\":\"7\",\"relOp\":\"5\",\"fields\":[\"s_suppkey\",\"ps_partkey\",\"ps_suppkey\",\"ps_supplycost\"],\"exprs\":[{\"input\":3,\"name\":\"$3\"},{\"input\":0,\"name\":\"$0\"},{\"input\":1,\"name\":\"$1\"},{\"input\":2,\"name\":\"$2\"}]},{\"id\":\"8\",\"relOp\":\"12\",\"group\":[1],\"aggs\":[{\"agg\":\"SqlMinMaxAggFunctionMIN\",\"type\":{\"type\":\"DECIMAL\",\"nullable\":true,\"precision\":15,\"scale\":2},\"distinct\":false,\"operands\":[3]}],\"parallel\":true},{\"id\":\"9\",\"relOp\":\"5\",\"fields\":[\"min(ps_supplycost)\",\"ps_partkey\"],\"exprs\":[{\"input\":1,\"name\":\"$1\"},{\"input\":0,\"name\":\"$0\"}]},{\"id\":\"10\",\"relOp\":\"18\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":0,\"name\":\"$0\"},{\"input\":10,\"name\":\"$10\"}]},\"joinType\":\"INNER\",\"inputs\":[\"3\",\"9\"]},{\"id\":\"11\",\"relOp\":\"4\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":7,\"name\":\"$7\"},{\"input\":9,\"name\":\"$9\"}]}},{\"id\":\"12\",\"relOp\":\"5\",\"fields\":[\"s_acctbal\",\"s_name\",\"n_name\",\"p_partkey\",\"p_mfgr\",\"s_address\",\"s_phone\",\"s_comment\"],\"exprs\":[{\"input\":5,\"name\":\"$5\"},{\"input\":2,\"name\":\"$2\"},{\"input\":8,\"name\":\"$8\"},{\"input\":0,\"name\":\"$0\"},{\"input\":1,\"name\":\"$1\"},{\"input\":3,\"name\":\"$3\"},{\"input\":4,\"name\":\"$4\"},{\"input\":6,\"name\":\"$6\"}]},{\"id\":\"13\",\"relOp\":\"3\",\"distribution\":{\"type\":\"SINGLETON\",\"keys\":[]},\"parallel\":true},{\"id\":\"14\",\"relOp\":\"9\",\"collation\":[{\"field\":0,\"direction\":\"DESCENDING\",\"nulls\":\"LAST\"},{\"field\":2,\"direction\":\"ASCENDING\",\"nulls\":\"FIRST\"},{\"field\":1,\"direction\":\"ASCENDING\",\"nulls\":\"FIRST\"},{\"field\":3,\"direction\":\"ASCENDING\",\"nulls\":\"FIRST\"}]}]}, tddl version: 5.x\n",
        " {\"rels\":[{\"id\":\"0\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"part\"],\"tableNames\":[\"part\",\"partsupp\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"part\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"partsupp\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"2\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperatorAND\\\",\\\"operands\\\":[{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":5,\\\"name\\\":\\\"$5\\\"},{\\\"index\\\":0,\\\"reltype\\\":{\\\"type\\\":\\\"BIGINT\\\",\\\"nullable\\\":false,\\\"precision\\\":19},\\\"type\\\":\\\"DYNAMIC\\\"}]},{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":9,\\\"name\\\":\\\"$9\\\"},{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"}]},{\\\"op\\\":\\\"SqlLikeOperatorLIKE\\\",\\\"operands\\\":[{\\\"input\\\":4,\\\"name\\\":\\\"$4\\\"},{\\\"index\\\":1,\\\"reltype\\\":{\\\"type\\\":\\\"CHAR\\\",\\\"nullable\\\":false,\\\"precision\\\":1},\\\"type\\\":\\\"DYNAMIC\\\"}]}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"0\\\",\\\"1\\\"]},{\\\"id\\\":\\\"3\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"p_partkey\\\",\\\"p_mfgr\\\",\\\"ps_suppkey\\\",\\\"ps_supplycost\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"},{\\\"input\\\":2,\\\"name\\\":\\\"$2\\\"},{\\\"input\\\":10,\\\"name\\\":\\\"$10\\\"},{\\\"input\\\":12,\\\"name\\\":\\\"$12\\\"}]}]}\",\"comparatives\":[{},{}],\"fullComparatives\":[{},{}]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"1\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"supplier\"],\"tableNames\":[\"supplier\",\"nation\",\"region\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"supplier\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"nation\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"2\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":7,\\\"name\\\":\\\"$7\\\"},{\\\"input\\\":3,\\\"name\\\":\\\"$3\\\"}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"0\\\",\\\"1\\\"]},{\\\"id\\\":\\\"3\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"region\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"4\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperatorAND\\\",\\\"operands\\\":[{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":12,\\\"name\\\":\\\"$12\\\"},{\\\"index\\\":2,\\\"reltype\\\":{\\\"type\\\":\\\"CHAR\\\",\\\"nullable\\\":false,\\\"precision\\\":1},\\\"type\\\":\\\"DYNAMIC\\\"}]},{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":9,\\\"name\\\":\\\"$9\\\"},{\\\"input\\\":11,\\\"name\\\":\\\"$11\\\"}]}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"2\\\",\\\"3\\\"]},{\\\"id\\\":\\\"5\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"s_suppkey\\\",\\\"s_name\\\",\\\"s_address\\\",\\\"s_phone\\\",\\\"s_acctbal\\\",\\\"s_comment\\\",\\\"n_name\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"},{\\\"input\\\":1,\\\"name\\\":\\\"$1\\\"},{\\\"input\\\":2,\\\"name\\\":\\\"$2\\\"},{\\\"input\\\":4,\\\"name\\\":\\\"$4\\\"},{\\\"input\\\":5,\\\"name\\\":\\\"$5\\\"},{\\\"input\\\":6,\\\"name\\\":\\\"$6\\\"},{\\\"input\\\":8,\\\"name\\\":\\\"$8\\\"}]}]}\",\"comparatives\":[{},{},{}],\"fullComparatives\":[{},{},{}]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"2\",\"relOp\":\"19\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":2,\"name\":\"$2\"},{\"input\":4,\"name\":\"$4\"}]},\"joinType\":\"INNER\",\"equalCondition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":2,\"name\":\"$2\"},{\"input\":4,\"name\":\"$4\"}]},\"parallel\":true,\"parallelBuild\":true,\"inputs\":[\"0\",\"1\"]},{\"id\":\"3\",\"relOp\":\"5\",\"fields\":[\"p_partkey\",\"p_mfgr\",\"s_name\",\"s_address\",\"s_phone\",\"s_acctbal\",\"s_comment\",\"ps_supplycost\",\"n_name\"],\"exprs\":[{\"input\":0,\"name\":\"$0\"},{\"input\":1,\"name\":\"$1\"},{\"input\":5,\"name\":\"$5\"},{\"input\":6,\"name\":\"$6\"},{\"input\":7,\"name\":\"$7\"},{\"input\":8,\"name\":\"$8\"},{\"input\":9,\"name\":\"$9\"},{\"input\":3,\"name\":\"$3\"},{\"input\":10,\"name\":\"$10\"}]},{\"id\":\"4\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"partsupp\"],\"tableNames\":[\"partsupp\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"partsupp\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"ps_partkey\\\",\\\"ps_suppkey\\\",\\\"ps_supplycost\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"},{\\\"input\\\":1,\\\"name\\\":\\\"$1\\\"},{\\\"input\\\":3,\\\"name\\\":\\\"$3\\\"}]}]}\",\"comparatives\":[],\"fullComparatives\":[]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"5\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"supplier\"],\"tableNames\":[\"supplier\",\"nation\",\"region\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"supplier\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"nation\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"2\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":3,\\\"name\\\":\\\"$3\\\"},{\\\"input\\\":7,\\\"name\\\":\\\"$7\\\"}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"0\\\",\\\"1\\\"]},{\\\"id\\\":\\\"3\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"region\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"4\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperatorAND\\\",\\\"operands\\\":[{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":12,\\\"name\\\":\\\"$12\\\"},{\\\"index\\\":3,\\\"reltype\\\":{\\\"type\\\":\\\"CHAR\\\",\\\"nullable\\\":false,\\\"precision\\\":1},\\\"type\\\":\\\"DYNAMIC\\\"}]},{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":9,\\\"name\\\":\\\"$9\\\"},{\\\"input\\\":11,\\\"name\\\":\\\"$11\\\"}]}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"2\\\",\\\"3\\\"]},{\\\"id\\\":\\\"5\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"s_suppkey\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"}]}]}\",\"comparatives\":[{},{},{}],\"fullComparatives\":[{},{},{}]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"6\",\"relOp\":\"19\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":1,\"name\":\"$1\"},{\"input\":3,\"name\":\"$3\"}]},\"joinType\":\"INNER\",\"equalCondition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":1,\"name\":\"$1\"},{\"input\":3,\"name\":\"$3\"}]},\"parallel\":true,\"parallelBuild\":true,\"inputs\":[\"4\",\"5\"]},{\"id\":\"7\",\"relOp\":\"5\",\"fields\":[\"s_suppkey\",\"ps_partkey\",\"ps_suppkey\",\"ps_supplycost\"],\"exprs\":[{\"input\":3,\"name\":\"$3\"},{\"input\":0,\"name\":\"$0\"},{\"input\":1,\"name\":\"$1\"},{\"input\":2,\"name\":\"$2\"}]},{\"id\":\"8\",\"relOp\":\"12\",\"group\":[1],\"aggs\":[{\"agg\":\"SqlMinMaxAggFunctionMIN\",\"type\":{\"type\":\"DECIMAL\",\"nullable\":true,\"precision\":15,\"scale\":2},\"distinct\":false,\"operands\":[3]}],\"parallel\":true},{\"id\":\"9\",\"relOp\":\"5\",\"fields\":[\"min(ps_supplycost)\",\"ps_partkey\"],\"exprs\":[{\"input\":1,\"name\":\"$1\"},{\"input\":0,\"name\":\"$0\"}]},{\"id\":\"10\",\"relOp\":\"18\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":0,\"name\":\"$0\"},{\"input\":10,\"name\":\"$10\"}]},\"joinType\":\"INNER\",\"inputs\":[\"3\",\"9\"]},{\"id\":\"11\",\"relOp\":\"4\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":7,\"name\":\"$7\"},{\"input\":9,\"name\":\"$9\"}]}},{\"id\":\"12\",\"relOp\":\"5\",\"fields\":[\"s_acctbal\",\"s_name\",\"n_name\",\"p_partkey\",\"p_mfgr\",\"s_address\",\"s_phone\",\"s_comment\"],\"exprs\":[{\"input\":5,\"name\":\"$5\"},{\"input\":2,\"name\":\"$2\"},{\"input\":8,\"name\":\"$8\"},{\"input\":0,\"name\":\"$0\"},{\"input\":1,\"name\":\"$1\"},{\"input\":3,\"name\":\"$3\"},{\"input\":4,\"name\":\"$4\"},{\"input\":6,\"name\":\"$6\"}]},{\"id\":\"13\",\"relOp\":\"3\",\"distribution\":{\"type\":\"SINGLETON\",\"keys\":[]},\"parallel\":true},{\"id\":\"14\",\"relOp\":\"9\",\"collation\":[{\"field\":0,\"direction\":\"DESCENDING\",\"nulls\":\"LAST\"},{\"field\":2,\"direction\":\"ASCENDING\",\"nulls\":\"FIRST\"},{\"field\":1,\"direction\":\"ASCENDING\",\"nulls\":\"FIRST\"},{\"field\":3,\"direction\":\"ASCENDING\",\"nulls\":\"FIRST\"}]}]}, tddl version: 5.x\n",
        " {\"rels\":[{\"id\":\"0\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"part\"],\"tableNames\":[\"part\",\"partsupp\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"part\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"partsupp\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"2\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperatorAND\\\",\\\"operands\\\":[{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":5,\\\"name\\\":\\\"$5\\\"},{\\\"index\\\":0,\\\"reltype\\\":{\\\"type\\\":\\\"BIGINT\\\",\\\"nullable\\\":false,\\\"precision\\\":19},\\\"type\\\":\\\"DYNAMIC\\\"}]},{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":9,\\\"name\\\":\\\"$9\\\"},{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"}]},{\\\"op\\\":\\\"SqlLikeOperatorLIKE\\\",\\\"operands\\\":[{\\\"input\\\":4,\\\"name\\\":\\\"$4\\\"},{\\\"index\\\":1,\\\"reltype\\\":{\\\"type\\\":\\\"CHAR\\\",\\\"nullable\\\":false,\\\"precision\\\":1},\\\"type\\\":\\\"DYNAMIC\\\"}]}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"0\\\",\\\"1\\\"]},{\\\"id\\\":\\\"3\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"p_partkey\\\",\\\"p_mfgr\\\",\\\"ps_suppkey\\\",\\\"ps_supplycost\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"},{\\\"input\\\":2,\\\"name\\\":\\\"$2\\\"},{\\\"input\\\":10,\\\"name\\\":\\\"$10\\\"},{\\\"input\\\":12,\\\"name\\\":\\\"$12\\\"}]}]}\",\"comparatives\":[{},{}],\"fullComparatives\":[{},{}]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"1\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"supplier\"],\"tableNames\":[\"supplier\",\"nation\",\"region\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"supplier\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"nation\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"2\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":7,\\\"name\\\":\\\"$7\\\"},{\\\"input\\\":3,\\\"name\\\":\\\"$3\\\"}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"0\\\",\\\"1\\\"]},{\\\"id\\\":\\\"3\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"region\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"4\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperatorAND\\\",\\\"operands\\\":[{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":12,\\\"name\\\":\\\"$12\\\"},{\\\"index\\\":2,\\\"reltype\\\":{\\\"type\\\":\\\"CHAR\\\",\\\"nullable\\\":false,\\\"precision\\\":1},\\\"type\\\":\\\"DYNAMIC\\\"}]},{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":9,\\\"name\\\":\\\"$9\\\"},{\\\"input\\\":11,\\\"name\\\":\\\"$11\\\"}]}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"2\\\",\\\"3\\\"]},{\\\"id\\\":\\\"5\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"s_suppkey\\\",\\\"s_name\\\",\\\"s_address\\\",\\\"s_phone\\\",\\\"s_acctbal\\\",\\\"s_comment\\\",\\\"n_name\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"},{\\\"input\\\":1,\\\"name\\\":\\\"$1\\\"},{\\\"input\\\":2,\\\"name\\\":\\\"$2\\\"},{\\\"input\\\":4,\\\"name\\\":\\\"$4\\\"},{\\\"input\\\":5,\\\"name\\\":\\\"$5\\\"},{\\\"input\\\":6,\\\"name\\\":\\\"$6\\\"},{\\\"input\\\":8,\\\"name\\\":\\\"$8\\\"}]}]}\",\"comparatives\":[{},{},{}],\"fullComparatives\":[{},{},{}]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"2\",\"relOp\":\"19\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":2,\"name\":\"$2\"},{\"input\":4,\"name\":\"$4\"}]},\"joinType\":\"INNER\",\"equalCondition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":2,\"name\":\"$2\"},{\"input\":4,\"name\":\"$4\"}]},\"parallel\":true,\"parallelBuild\":true,\"inputs\":[\"0\",\"1\"]},{\"id\":\"3\",\"relOp\":\"5\",\"fields\":[\"p_partkey\",\"p_mfgr\",\"s_name\",\"s_address\",\"s_phone\",\"s_acctbal\",\"s_comment\",\"ps_supplycost\",\"n_name\"],\"exprs\":[{\"input\":0,\"name\":\"$0\"},{\"input\":1,\"name\":\"$1\"},{\"input\":5,\"name\":\"$5\"},{\"input\":6,\"name\":\"$6\"},{\"input\":7,\"name\":\"$7\"},{\"input\":8,\"name\":\"$8\"},{\"input\":9,\"name\":\"$9\"},{\"input\":3,\"name\":\"$3\"},{\"input\":10,\"name\":\"$10\"}]},{\"id\":\"4\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"partsupp\"],\"tableNames\":[\"partsupp\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"partsupp\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"ps_partkey\\\",\\\"ps_suppkey\\\",\\\"ps_supplycost\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"},{\\\"input\\\":1,\\\"name\\\":\\\"$1\\\"},{\\\"input\\\":3,\\\"name\\\":\\\"$3\\\"}]}]}\",\"comparatives\":[],\"fullComparatives\":[]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"5\",\"relOp\":\"0\",\"table\":[\"FANGWU_TPCH_APP\",\"supplier\"],\"tableNames\":[\"supplier\",\"nation\",\"region\"],\"pushDownOpt\":{\"pushrels\":\"{\\\"rels\\\":[{\\\"id\\\":\\\"0\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"supplier\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"1\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"nation\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"2\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":3,\\\"name\\\":\\\"$3\\\"},{\\\"input\\\":7,\\\"name\\\":\\\"$7\\\"}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"0\\\",\\\"1\\\"]},{\\\"id\\\":\\\"3\\\",\\\"relOp\\\":\\\"1\\\",\\\"table\\\":[\\\"FANGWU_TPCH_APP\\\",\\\"region\\\"],\\\"inputs\\\":[]},{\\\"id\\\":\\\"4\\\",\\\"relOp\\\":\\\"2\\\",\\\"condition\\\":{\\\"op\\\":\\\"SqlBinaryOperatorAND\\\",\\\"operands\\\":[{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":12,\\\"name\\\":\\\"$12\\\"},{\\\"index\\\":3,\\\"reltype\\\":{\\\"type\\\":\\\"CHAR\\\",\\\"nullable\\\":false,\\\"precision\\\":1},\\\"type\\\":\\\"DYNAMIC\\\"}]},{\\\"op\\\":\\\"SqlBinaryOperator=\\\",\\\"operands\\\":[{\\\"input\\\":9,\\\"name\\\":\\\"$9\\\"},{\\\"input\\\":11,\\\"name\\\":\\\"$11\\\"}]}]},\\\"joinType\\\":\\\"INNER\\\",\\\"inputs\\\":[\\\"2\\\",\\\"3\\\"]},{\\\"id\\\":\\\"5\\\",\\\"relOp\\\":\\\"5\\\",\\\"fields\\\":[\\\"s_suppkey\\\"],\\\"exprs\\\":[{\\\"input\\\":0,\\\"name\\\":\\\"$0\\\"}]}]}\",\"comparatives\":[{},{},{}],\"fullComparatives\":[{},{},{}]},\"unionSize\":-1,\"parallel\":true},{\"id\":\"6\",\"relOp\":\"19\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":1,\"name\":\"$1\"},{\"input\":3,\"name\":\"$3\"}]},\"joinType\":\"INNER\",\"equalCondition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":1,\"name\":\"$1\"},{\"input\":3,\"name\":\"$3\"}]},\"parallel\":true,\"parallelBuild\":true,\"inputs\":[\"4\",\"5\"]},{\"id\":\"7\",\"relOp\":\"5\",\"fields\":[\"s_suppkey\",\"ps_partkey\",\"ps_suppkey\",\"ps_supplycost\"],\"exprs\":[{\"input\":3,\"name\":\"$3\"},{\"input\":0,\"name\":\"$0\"},{\"input\":1,\"name\":\"$1\"},{\"input\":2,\"name\":\"$2\"}]},{\"id\":\"8\",\"relOp\":\"12\",\"group\":[1],\"aggs\":[{\"agg\":\"SqlMinMaxAggFunctionMIN\",\"type\":{\"type\":\"DECIMAL\",\"nullable\":true,\"precision\":15,\"scale\":2},\"distinct\":false,\"operands\":[3]}],\"parallel\":true},{\"id\":\"9\",\"relOp\":\"5\",\"fields\":[\"min(ps_supplycost)\",\"ps_partkey\"],\"exprs\":[{\"input\":1,\"name\":\"$1\"},{\"input\":0,\"name\":\"$0\"}]},{\"id\":\"10\",\"relOp\":\"18\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":0,\"name\":\"$0\"},{\"input\":10,\"name\":\"$10\"}]},\"joinType\":\"INNER\",\"inputs\":[\"3\",\"9\"]},{\"id\":\"11\",\"relOp\":\"4\",\"condition\":{\"op\":\"SqlBinaryOperator=\",\"operands\":[{\"input\":7,\"name\":\"$7\"},{\"input\":9,\"name\":\"$9\"}]}},{\"id\":\"12\",\"relOp\":\"5\",\"fields\":[\"s_acctbal\",\"s_name\",\"n_name\",\"p_partkey\",\"p_mfgr\",\"s_address\",\"s_phone\",\"s_comment\"],\"exprs\":[{\"input\":5,\"name\":\"$5\"},{\"input\":2,\"name\":\"$2\"},{\"input\":8,\"name\":\"$8\"},{\"input\":0,\"name\":\"$0\"},{\"input\":1,\"name\":\"$1\"},{\"input\":3,\"name\":\"$3\"},{\"input\":4,\"name\":\"$4\"},{\"input\":6,\"name\":\"$6\"}]},{\"id\":\"13\",\"relOp\":\"3\",\"distribution\":{\"type\":\"SINGLETON\",\"keys\":[]},\"parallel\":true},{\"id\":\"14\",\"relOp\":\"9\",\"collation\":[{\"field\":0,\"direction\":\"DESCENDING\",\"nulls\":\"LAST\"},{\"field\":2,\"direction\":\"ASCENDING\",\"nulls\":\"FIRST\"},{\"field\":1,\"direction\":\"ASCENDING\",\"nulls\":\"FIRST\"},{\"field\":3,\"direction\":\"ASCENDING\",\"nulls\":\"FIRST\"}]}]}, tddl version: 5.x\n",
    };

    @Test
    public void testZlib() {
        long start = System.currentTimeMillis();
        long length = 0;
        int count = 0;
        long originLength = 0l;
        List<byte[]> tempBytes = Lists.newArrayList();
        for (String plan : plans) {
            count++;
            byte[] rs = PlanManagerUtil.compressPlan(plan);
            length += rs.length;
            tempBytes.add(rs);
            originLength += plan.getBytes().length;
        }
        long end = System.currentTimeMillis();
        System.out.println(
            "Zlib, test count:" + count + ", compress size:" + length + ", time:" + (end - start) + " originLength:"
                + originLength);
        start = System.currentTimeMillis();
        for (byte[] rs : tempBytes) {
            byte[] originBytes = PlanManagerUtil.uncompress(rs);
        }
        System.out.println("uncompres time:" + (System.currentTimeMillis() - start));
    }

//    @Test
//    public void testZstd(){
//        long start = System.currentTimeMillis();
//        long length = 0;
//        int count = 0;
//        List<byte[]> tempBytes = Lists.newArrayList();
//        for(String plan:plans){
//            count++;
//            byte[] origin = plan.getBytes();
//            byte[] rs = Zstd.compress(origin);
//            length += rs.length;
//            tempBytes.add(rs);
//        }
//        long end = System.currentTimeMillis();
//        System.out.println("Zstd, test count:" + count + ", compress size:" + length + ", time:" + (end-start));
//
//        start = System.currentTimeMillis();
//        for(int i=0;i<tempBytes.size();i++){
//            byte[] originBytes = Zstd.decompress(tempBytes.get(i), 60000);
//        }
//        System.out.println("uncompres time:" + (System.currentTimeMillis()-start));
//    }

}
